from flask import Flask, jsonify
from flask_cors import CORS
from analyse.main import *

app = Flask(__name__)
CORS(app, resources=r'/*')


@app.route('/')
def hello_world():  # put application's code here
    return 'Hello World!'


@app.route('/bar', methods=['POST'])
def box_top10():
    return jsonify(box_top10_data())


@app.route('/line', methods=['POST'])
def top1_movie_daily_trends():
    return jsonify(box_top1_movie_daily_trends())


@app.route('/pie', methods=['POST'])
def box_ratio():
    return jsonify(movie_box_ratio())


@app.route('/scatter', methods=['POST'])
def scatter():
    return jsonify(movie_box_and_show_count_scatter())


@app.route('/heatmap', methods=['POST'])
def heatmap():
    return jsonify(top1_movie_heat_trends())


if __name__ == '__main__':
    app.run()
